package com.irun.news.ui.dialog;

import com.irun.news.R;

import android.app.Dialog;
import android.content.Context;
import android.text.TextUtils;
import android.widget.TextView;

/***
 * @author huangsm
 * @date 2013-3-30
 * @email huangsanm@gmail.com
 * @desc 加载进度dialog
 */
public class ProgressDialogLoad extends Dialog {

	//提示信息
	private TextView mTipTextView;
	
	public ProgressDialogLoad(Context context) {
		super(context, android.R.style.Theme_Dialog);
		
		initContentViews();
	}
	
	public ProgressDialogLoad(Context context, int style) {
		super(context, style);
		initContentViews();
	}

	private void initContentViews(){
		setContentView(R.layout.progress_layout);
		mTipTextView = (TextView) findViewById(R.id.dialog_tips);
	}
	
	public void setMessage(String text){
		mTipTextView.setText(text);
	}
	
	public void setMessage(int text){
		mTipTextView.setText(text);
	}
	
	public static ProgressDialogLoad show(Context context, String message, boolean cancel){
		ProgressDialogLoad dialog = new ProgressDialogLoad(context);
		if(!TextUtils.isEmpty(message))
			dialog.setMessage(message);
		dialog.setCancelable(cancel);
		dialog.show();
		return dialog;
	}
}
